package com.jaux.hotel.controller;

import com.jaux.hotel.common.Result;
import com.jaux.hotel.dto.ClassesDetailDto;
import com.jaux.hotel.pojo.Classes;
import com.jaux.hotel.service.ClassesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 16778
 */
@Api(tags = "班级管理接口")
@RestController
@RequestMapping("/class")
public class ClassesController {
    @Autowired
    private ClassesService classesService;

    @ApiOperation("查询班级信息")
    @GetMapping("/info/{classesId}")
    public Result<ClassesDetailDto> selectClassesList(@PathVariable("classesId") String classesId) {
       return classesService.selectClassList(classesId);
    }

    /**
     * 新增数据
     *
     * @param classes 实例对象
     * @return 实例对象
     */
    @PostMapping("/add")
    @ApiOperation(value = "班级新增", notes = "添加班级信息")
    public Result<String> addStudent(@RequestBody Classes classes){

        String info = classesService.addClass(classes);
        return Result.success(null, info);
    }
}
